#include "FlatPass.h"

namespace egg{

    FlatPass::FlatPass():MaterialPass(gGPUProgramGroup->getItem("flat")){
        NumericParamPtr color(new NumericParam(GPT_Vec4,"color"));
        bindParam(gGPUParamGroup->mProjectionMatrix);
        bindParam(gGPUParamGroup->mLocal2EyeMatrix);
        bindParam(color);
    }

    void FlatPass::_draw(RenderContext& _context,Drawable3D& _drawable){
        gGPUParamGroup->mLocal2EyeMatrix->set(
            _context.mCamera->getWorld2EyeMatrix()*
            _drawable.mLocal2WorldMatrix);
        this->activate();
        _drawable.mGeometry->draw(DM_Triangles);
    }

}